home *** CD-ROM | disk | FTP | other *** search
- /*******************************************\
- * file: PrintUtils.h *
- * version: 1.0ß *
- * *
- * ----------------------------------------- *
- * By: Donald Koscheka *
- * Date: 30-OCT-89 *
- * © Copyright 1989, Donald Koscheka *
- * All Rights Reserved *
- * *
- * ----------------------------------------- *
- \*******************************************/
-
- /********************************************/
- /* --- CONSTANTS --- */
- /********************************************/
-
- #define CARD TRUE
- #define BKGND FALSE
- #define NULL 0x00
- #define TAB 0x09
- #define CR 0x0D
- #define LF 0x0A
- #define FF 0x0C
- #define QUOTE 0x22
- #define COMMA 0x2C
- #define PERIOD 0x2E
- #define PAREN 0x28
-
- #define TIMES 20
- #define DEFAULT_FONT 20 /*** Times ***/
- #define DEFAULT_SIZE 12
- #define PLAIN_TEXT 0
- #define teJustFill 2
-
- #define PAGE_INFO 'pifr'
- #define PAGE_ID 128
-
- #define TEXT_JUSTIFICATION 12396
- #define TEXT_STYLES 12549
- #define STRING_TYPE 'STR#'
- #define TEXT_SIZE 10
-
- enum{ /*** different device types ***/
- Screen = 1,
- Printer,
- File,
- Remote
- };
-
-
- /********************************************/
- /* --- TYPE DEFINITIONS --- */
- /********************************************/
-
- /*** This structure is used internally by ***/
- /*** the printing routines. ***/
- typedef struct styleSet{
- short Font; /*** current font ***/
- short Size; /*** current font size ***/
- short Style; /*** current font style ***/
- short Just; /*** current justification ***/
- }styleSet, *stylePtr;
-
-
- /*** footnote ***/
- /*** this is a study piece only we'll want to embellish this concept ***/
-
- typedef struct{
- Handle key1;
- Handle key2;
- Handle key3;
- short hite; /*** if zero, no footnote set ***/
- }foot, *footPtr, *footHand;
-
-
- typedef struct{
- short portType; /*** RESERVED FOR FUTURE EXPANSION ***/
- GrafPtr prPort; /*** pointer to the display port ***/
- Point curntPen; /*** where we currently drawing ***/
- Rect margin; /*** "local" paragraph margin ***/
- styleSet curntStyle; /*** current style settings ***/
- styleSet defaultStyle; /*** default style settings ***/
-
- short pagecount; /*** number of the current page ***/
- short totalpages; /*** total pages printed in doc ***/
- /*** following will go in a union ***/
- /*** so structure can be used for ***/
- /*** for screen drawing also. ***/
- THPrint prRecHandle; /*** Handle to to printing rec. ***/
- TPrStatus myStRec; /*** print style information ***/
- foot footNote;
- }pInfo, *pInfoPtr, **pInfoHand;
-
-
-
- /********************************************/
- /* --- FUNCTION PROTOTYPES --- */
- /********************************************/
-
- long matchToken( Handle buf, short tabl );
- long parseNum( char *bp );
- char *nextToken( char *bp );
- void parseRect( Handle buf, Rect *theRect );
- void PrintString( pInfoPtr pp, Handle theText, short hite );
- void PrintParagraph();
- void CheckPageBreak();
- void SetMargin( pInfoPtr pp, short t, short l, short b, short r );
-
- void DrawTextRun();
-
- void SetFont( stylePtr sp, short theFont);
- void SetFontSize( stylePtr sp, short theSize);
- void SetFontStyle( stylePtr pp, short theStyle);
- void SetFontJust( stylePtr sp, short theJust);
-
- void SetFontStyles( pInfoPtr pp, stylePtr sp );
-